package com.ayou.eggguard.farm.mapper;

import com.ayou.eggguard.farm.pojo.Blight;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BlightMapper {
    List<Blight> getBlights(String blightName);

    @Insert("insert into blight(blight_name, blight_type, symptom, infectivity, cheat_method, precaution, note) " +
            "values(#{blightName},#{blightType},#{symptom},#{infectivity},#{cheatMethod},#{precaution},#{note})")
    void add(Blight blight);

    @Update("update blight set blight_name=#{blightName},blight_type=#{blightType},symptom=#{symptom}," +
            "infectivity=#{infectivity},cheat_method=#{cheatMethod},precaution=#{precaution},note=#{note} " +
            "where id=#{id}")
    void update(Blight blight);

    @Delete("delete from blight where id=#{id}")
    void delete(Integer id);

    @Select("select blight.blight_name from blight")
    List<String> getBlightName();
}
